/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package TCPclient.app;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author emanuellima
 */
public class ClientTCP implements Runnable  {
    
    private InetAddress addr;       // Endereço IP.
    private int port = 8080;               // Porta Usada
    private Socket socket;
    private DataOutputStream outstream; // Cria um canal para enviar Dados
    private DataInputStream instream;   // Cria um canal para receber Dados
    private String name;
    
    
    
    public ClientTCP (){
        
    }
    
    @Override
    public void run() {
        try {
            setSocket(new Socket("localhost", port));
            System.out.println("O cliente se conectou ao servidor!");
            
        } catch (IOException ex) {
            Logger.getLogger(ClientTCP.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    /**
     * @return the socket
     */
    public Socket getSocket() {
        return socket;
    }

    /**
     * @param socket the socket to set
     */
    public void setSocket(Socket socket) {
        this.socket = socket;
    }
    
}
